This RScatter chart has all of the datasets (of which there are 5) specified as one big multi-dimensional array.
An example of multiple datasets as one big array.
This goes in the documents header:<script src="RGraph.common.core.js"></script> <script src="RGraph.common.dynamic.js"></script> <script src="RGraph.common.tooltips.js"></script> <script src="RGraph.rscatter.js"></script>Put this where you want the chart to show up:
<canvas id="cvs" width="500" height="500"> [No canvas support] </canvas>This is the code that generates the chart:
<script>
window.onload = function ()
{
var data = [];
var colors = ['red','blue','green','pink','black'];
// Create some data
for (var i=0; i<5; i+=1) {
data[i] = [];
for (var j=0; j<10; j+=1) {
var x = ((i+1) * 72) + 5;
var y = j * 5;
data[i][j] = [x, y, colors[i], 'X: ' + x + ', Y: ' + y]
}
}
var rscatter = new RGraph.RScatter({
id: 'cvs',
data: data,
options: {
textAccessible: true
}
}).draw();
};
</script>